---
id: 658246c28575d653d1f89b59
title: Passo 24
challengeType: 20
dashedName: step-24
---

# --description--

A `while` loop is another kind of loop that runs a portion of code until a specified condition is `True`:

```py
while condition:
    <code>
```

Below the `expenses` list, create a `while` loop. Use `True` for the condition, and print the string `'\nExpense Tracker'` inside the loop body to show the title of the program.

# --hints--

You should have `while True:` in your `main()` function.

```js
({ test: () =>
  {
    const transformedCode = code.replace(/\r/g, "");        
    const foo = __helpers.python.getDef("\n"+transformedCode, "main");
    const {function_body} = foo;    
    assert(function_body.match(/^\s+while\s+True\s*:/m));
  }
})
```

You should have `print('\nExpense Tracker')` in your `while` loop.

```js
({ test: () =>
  {
    const transformedCode = code.replace(/\r/g, "");        
    const foo = __helpers.python.getDef("\n"+transformedCode, "main");
    const {function_body} = foo;    
    assert(function_body.match(/^\s+print\s*\(\s*("|')\\nExpense\s*Tracker\1\s*\)/m));
  }
})
```

# --seed--

## --seed-contents--

```py
def add_expense(expenses, amount, category):
    expenses.append({'amount': amount, 'category': category})

def print_expenses(expenses):
    for expense in expenses:
        print(f'Amount: {expense["amount"]}, Category: {expense["category"]}')

def total_expenses(expenses):
    return sum(map(lambda expense: expense['amount'], expenses))

def filter_expenses_by_category(expenses, category):
    return filter(lambda expense: expense['category'] == category, expenses)
--fcc-editable-region--
def main():
    expenses = []

--fcc-editable-region--
```
